new Vue({
    el: "#app",
    data: {
        userList:[],
        user: {
            id: 0,
            username: "",
            age: 0,
            password: "",
            email: "",
            sex: ""
        }
    },
    methods: {
        findAll() {
            var _this = this;
            axios.get("/user/findAll").then(function (response) {
                _this.userList=response.data;
            })
        },
        findById(id) {
            var _this = this;
            axios.get("/user/findById?id="+id).then(function (response) {
                _this.user=response.data;
                $("#myModal").modal("show");
            })
        },
        update() {
            var _this = this;
            axios.post("/user/update",_this.user).then(function (response) {
                _this.findAll();
            })
        }
    },
    created: function () {
        this.findAll();
    }
});